<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-urllib2.html" />
<link rel="prev" href="module-wsgiref.html" />
<link rel="parent" href="internet.html" />
<link rel="next" href="urlopener-objs.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>18.5 urllib -- Open arbitrary resources by URL</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="18.4.5 wsgiref.handlers - server/gateway"
  href="module-wsgiref.handlers.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="18. internet Protocols and"
  href="internet.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="18.5.1 urlopener Objects"
  href="urlopener-objs.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-wsgiref.handlers.html">18.4.5 wsgiref.handlers - server/gateway</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="internet.html">18. Internet Protocols and</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="urlopener-objs.html">18.5.1 URLopener Objects</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h1><a name="SECTION0020500000000000000000">
18.5 <tt class="module">urllib</tt> --
         Open arbitrary resources by URL</a>
</h1>

<p>
<a name="module-urllib"></a>

<p>
<a id='l2h-3911' xml:id='l2h-3911'></a>

<p>
This module provides a high-level interface for fetching data across
the World Wide Web.  In particular, the <tt class="function">urlopen()</tt> function
is similar to the built-in function <tt class="function">open()</tt>, but accepts
Universal Resource Locators (URLs) instead of filenames.  Some
restrictions apply -- it can only open URLs for reading, and no seek
operations are available.

<p>
It defines the following public functions:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3892' xml:id='l2h-3892' class="function">urlopen</tt></b>(</nobr></td>
  <td><var>url</var><big>[</big><var>, data</var><big>[</big><var>, proxies</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Open a network object denoted by a URL for reading.  If the URL does
not have a scheme identifier, or if it has <span class="file">file:</span> as its scheme
identifier, this opens a local file (without universal newlines);
otherwise it opens a socket to a server somewhere on the network.  If
the connection cannot be made
the <tt class="exception">IOError</tt> exception is raised.  If all went well, a
file-like object is returned.  This supports the following methods:
<tt class="method">read()</tt>, <tt class="method">readline()</tt>, <tt class="method">readlines()</tt>, <tt class="method">fileno()</tt>,
<tt class="method">close()</tt>, <tt class="method">info()</tt> and <tt class="method">geturl()</tt>.  It also has
proper support for the iterator protocol.
One caveat: the <tt class="method">read()</tt> method, if the size argument is
omitted or negative, may not read until the end of the data stream;
there is no good way to determine that the entire stream from a socket
has been read in the general case.

<p>
Except for the <tt class="method">info()</tt> and <tt class="method">geturl()</tt> methods,
these methods have the same interface as for
file objects -- see section <a href="bltin-file-objects.html#bltin-file-objects">3.9</a> in this
manual.  (It is not a built-in file object, however, so it can't be
used at those few places where a true built-in file object is
required.)

<p>
The <tt class="method">info()</tt> method returns an instance of the class
<tt class="class">mimetools.Message</tt> containing meta-information associated
with the URL.  When the method is HTTP, these headers are those
returned by the server at the head of the retrieved HTML page
(including Content-Length and Content-Type).  When the method is FTP,
a Content-Length header will be present if (as is now usual) the
server passed back a file length in response to the FTP retrieval
request. A Content-Type header will be present if the MIME type can
be guessed.  When the method is local-file, returned headers will include
a Date representing the file's last-modified time, a Content-Length
giving file size, and a Content-Type containing a guess at the file's
type. See also the description of the
<tt class="module"><a href="module-mimetools.html">mimetools</a></tt><a id='l2h-3912' xml:id='l2h-3912'></a> module.

<p>
The <tt class="method">geturl()</tt> method returns the real URL of the page.  In
some cases, the HTTP server redirects a client to another URL.  The
<tt class="function">urlopen()</tt> function handles this transparently, but in some
cases the caller needs to know which URL the client was redirected
to.  The <tt class="method">geturl()</tt> method can be used to get at this
redirected URL.

<p>
If the <var>url</var> uses the <span class="file">http:</span> scheme identifier, the optional
<var>data</var> argument may be given to specify a <code>POST</code> request
(normally the request type is <code>GET</code>).  The <var>data</var> argument
must be in standard <span class="mimetype">application/x-www-form-urlencoded</span> format;
see the <tt class="function">urlencode()</tt> function below.

<p>
The <tt class="function">urlopen()</tt> function works transparently with proxies
which do not require authentication.  In a <span class="Unix">Unix</span> or Windows
environment, set the <a class="envvar" id='l2h-3913' xml:id='l2h-3913'>http_proxy</a>, <a class="envvar" id='l2h-3914' xml:id='l2h-3914'>ftp_proxy</a> or
<a class="envvar" id='l2h-3915' xml:id='l2h-3915'>gopher_proxy</a> environment variables to a URL that identifies
the proxy server before starting the Python interpreter.  For example
(the "<tt class="character">%</tt>" is the command prompt):

<p>
<div class="verbatim"><pre>
% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python
...
</pre></div>

<p>
In a Windows environment, if no proxy environment variables are set,
proxy settings are obtained from the registry's Internet Settings
section.

<p>
In a Macintosh environment, <tt class="function">urlopen()</tt> will retrieve proxy
information from Internet<a id='l2h-3916' xml:id='l2h-3916'></a> Config.

<p>
Alternatively, the optional <var>proxies</var> argument may be used to
explicitly specify proxies.  It must be a dictionary mapping scheme
names to proxy URLs, where an empty dictionary causes no proxies to be
used, and <code>None</code> (the default value) causes environmental proxy
settings to be used as discussed above.  For example:

<p>
<div class="verbatim"><pre>
# Use http://www.someproxy.com:3128 for http proxying
proxies = {'http': 'http://www.someproxy.com:3128'}
filehandle = urllib.urlopen(some_url, proxies=proxies)
# Don't use any proxies
filehandle = urllib.urlopen(some_url, proxies={})
# Use proxies from environment - both versions are equivalent
filehandle = urllib.urlopen(some_url, proxies=None)
filehandle = urllib.urlopen(some_url)
</pre></div>

<p>
The <tt class="function">urlopen()</tt> function does not support explicit proxy
specification.  If you need to override environmental proxy settings,
use <tt class="class">URLopener</tt>, or a subclass such as <tt class="class">FancyURLopener</tt>.

<p>
Proxies which require authentication for use are not currently
supported; this is considered an implementation limitation.

<p>

<span class="versionnote">Changed in version 2.3:
Added the <var>proxies</var> support.</span>

</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3893' xml:id='l2h-3893' class="function">urlretrieve</tt></b>(</nobr></td>
  <td><var>url</var><big>[</big><var>, filename</var><big>[</big><var>,
                              reporthook</var><big>[</big><var>, data</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Copy a network object denoted by a URL to a local file, if necessary.
If the URL points to a local file, or a valid cached copy of the
object exists, the object is not copied.  Return a tuple
<code>(<var>filename</var>, <var>headers</var>)</code> where <var>filename</var> is the
local file name under which the object can be found, and <var>headers</var>
is whatever the <tt class="method">info()</tt> method of the object returned by
<tt class="function">urlopen()</tt> returned (for a remote object, possibly cached).
Exceptions are the same as for <tt class="function">urlopen()</tt>.

<p>
The second argument, if present, specifies the file location to copy
to (if absent, the location will be a tempfile with a generated name).
The third argument, if present, is a hook function that will be called
once on establishment of the network connection and once after each
block read thereafter.  The hook will be passed three arguments; a
count of blocks transferred so far, a block size in bytes, and the
total size of the file.  The third argument may be <code>-1</code> on older
FTP servers which do not return a file size in response to a retrieval
request.

<p>
If the <var>url</var> uses the <span class="file">http:</span> scheme identifier, the optional
<var>data</var> argument may be given to specify a <code>POST</code> request
(normally the request type is <code>GET</code>).  The <var>data</var> argument
must in standard <span class="mimetype">application/x-www-form-urlencoded</span> format;
see the <tt class="function">urlencode()</tt> function below.

<p>

<span class="versionnote">Changed in version 2.5:

<tt class="function">urlretrieve()</tt> will raise <tt class="exception">ContentTooShortError</tt>
when it detects that the amount of data available 
was less than the expected amount (which is the size reported by a 
<var>Content-Length</var> header). This can occur, for example, when the 
download is interrupted.

<p>
The <var>Content-Length</var> is treated as a lower bound: if there's more data 
to read, urlretrieve reads more data, but if less data is available, 
it raises the exception.

<p>
You can still retrieve the downloaded data in this case, it is stored 
in the <tt class="member">content</tt> attribute of the exception instance.

<p>
If no <var>Content-Length</var> header was supplied, urlretrieve can
not check the size of the data it has downloaded, and just returns it. 
In this case you just have to assume that the download was successful.</span>

<p>
</dl>

<p>
<dl><dt><b><tt id='l2h-3894' xml:id='l2h-3894'>_urlopener</tt></b></dt>
<dd>
The public functions <tt class="function">urlopen()</tt> and
<tt class="function">urlretrieve()</tt> create an instance of the
<tt class="class">FancyURLopener</tt> class and use it to perform their requested
actions.  To override this functionality, programmers can create a
subclass of <tt class="class">URLopener</tt> or <tt class="class">FancyURLopener</tt>, then assign
an instance of that class to the
<code>urllib._urlopener</code> variable before calling the desired function.
For example, applications may want to specify a different
<span class="mailheader">User-Agent:</span> header than <tt class="class">URLopener</tt> defines.  This
can be accomplished with the following code:

<p>
<div class="verbatim"><pre>
import urllib

class AppURLopener(urllib.FancyURLopener):
    version = "App/1.7"

urllib._urlopener = AppURLopener()
</pre></div>
</dd></dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3895' xml:id='l2h-3895' class="function">urlcleanup</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Clear the cache that may have been built up by previous calls to
<tt class="function">urlretrieve()</tt>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3896' xml:id='l2h-3896' class="function">quote</tt></b>(</nobr></td>
  <td><var>string</var><big>[</big><var>, safe</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Replace special characters in <var>string</var> using the "<tt class="samp">%xx</tt>" escape.
Letters, digits, and the characters "<tt class="character">_.-</tt>" are never quoted.
The optional <var>safe</var> parameter specifies additional characters
that should not be quoted -- its default value is <code>'/'</code>.

<p>
Example: <code>quote('/~connolly/')</code> yields <code>'/%7econnolly/'</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3897' xml:id='l2h-3897' class="function">quote_plus</tt></b>(</nobr></td>
  <td><var>string</var><big>[</big><var>, safe</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Like <tt class="function">quote()</tt>, but also replaces spaces by plus signs, as
required for quoting HTML form values.  Plus signs in the original
string are escaped unless they are included in <var>safe</var>.  It also
does not have <var>safe</var> default to <code>'/'</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3898' xml:id='l2h-3898' class="function">unquote</tt></b>(</nobr></td>
  <td><var>string</var>)</td></tr></table></dt>
<dd>
Replace "<tt class="samp">%xx</tt>" escapes by their single-character equivalent.

<p>
Example: <code>unquote('/%7Econnolly/')</code> yields <code>'/~connolly/'</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3899' xml:id='l2h-3899' class="function">unquote_plus</tt></b>(</nobr></td>
  <td><var>string</var>)</td></tr></table></dt>
<dd>
Like <tt class="function">unquote()</tt>, but also replaces plus signs by spaces, as
required for unquoting HTML form values.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3900' xml:id='l2h-3900' class="function">urlencode</tt></b>(</nobr></td>
  <td><var>query</var><big>[</big><var>, doseq</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Convert a mapping object or a sequence of two-element tuples  to a
``url-encoded'' string, suitable to pass to
<tt class="function">urlopen()</tt> above as the optional <var>data</var> argument.  This
is useful to pass a dictionary of form fields to a <code>POST</code>
request.  The resulting string is a series of
<code><var>key</var>=<var>value</var></code> pairs separated by "<tt class="character">&amp;</tt>"
characters, where both <var>key</var> and <var>value</var> are quoted using
<tt class="function">quote_plus()</tt> above.  If the optional parameter <var>doseq</var> is
present and evaluates to true, individual <code><var>key</var>=<var>value</var></code> pairs
are generated for each element of the sequence.
When a sequence of two-element tuples is used as the <var>query</var> argument,
the first element of each tuple is a key and the second is a value.  The
order of parameters in the encoded string will match the order of parameter
tuples in the sequence.
The <tt class="module"><a href="module-cgi.html">cgi</a></tt> module provides the functions
<tt class="function">parse_qs()</tt> and <tt class="function">parse_qsl()</tt> which are used to
parse query strings into Python data structures.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3901' xml:id='l2h-3901' class="function">pathname2url</tt></b>(</nobr></td>
  <td><var>path</var>)</td></tr></table></dt>
<dd>
Convert the pathname <var>path</var> from the local syntax for a path to
the form used in the path component of a URL.  This does not produce a
complete URL.  The return value will already be quoted using the
<tt class="function">quote()</tt> function.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3902' xml:id='l2h-3902' class="function">url2pathname</tt></b>(</nobr></td>
  <td><var>path</var>)</td></tr></table></dt>
<dd>
Convert the path component <var>path</var> from an encoded URL to the local
syntax for a path.  This does not accept a complete URL.  This
function uses <tt class="function">unquote()</tt> to decode <var>path</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-3903' xml:id='l2h-3903' class="class">URLopener</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>proxies</var><big>[</big><var>, **x509</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Base class for opening and reading URLs.  Unless you need to support
opening objects using schemes other than <span class="file">http:</span>, <span class="file">ftp:</span>,
<span class="file">gopher:</span> or <span class="file">file:</span>, you probably want to use
<tt class="class">FancyURLopener</tt>.

<p>
By default, the <tt class="class">URLopener</tt> class sends a
<span class="mailheader">User-Agent:</span> header of "<tt class="samp">urllib/<var>VVV</var></tt>", where
<var>VVV</var> is the <tt class="module">urllib</tt> version number.  Applications can
define their own <span class="mailheader">User-Agent:</span> header by subclassing
<tt class="class">URLopener</tt> or <tt class="class">FancyURLopener</tt> and setting the class
attribute <tt class="member">version</tt> to an appropriate string value in the
subclass definition.

<p>
The optional <var>proxies</var> parameter should be a dictionary mapping
scheme names to proxy URLs, where an empty dictionary turns proxies
off completely.  Its default value is <code>None</code>, in which case
environmental proxy settings will be used if present, as discussed in
the definition of <tt class="function">urlopen()</tt>, above.

<p>
Additional keyword parameters, collected in <var>x509</var>, may be used for
authentication of the client when using the <span class="file">https:</span> scheme.  The keywords
<var>key_file</var> and <var>cert_file</var> are supported to provide an 
SSL key and certificate; both are needed to support client authentication.

<p>
<tt class="class">URLopener</tt> objects will raise an <tt class="exception">IOError</tt> exception
if the server returns an error code.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-3904' xml:id='l2h-3904' class="class">FancyURLopener</tt></b>(</nobr></td>
  <td><var>...</var>)</td></tr></table></dt>
<dd>
<tt class="class">FancyURLopener</tt> subclasses <tt class="class">URLopener</tt> providing default
handling for the following HTTP response codes: 301, 302, 303, 307 and
401.  For the 30x response codes listed above, the
<span class="mailheader">Location:</span> header is used to fetch the actual URL.  For 401
response codes (authentication required), basic HTTP authentication is
performed.  For the 30x response codes, recursion is bounded by the
value of the <var>maxtries</var> attribute, which defaults to 10.

<p>
For all other response codes, the method <tt class="method">http_error_default()</tt>
is called which you can override in subclasses to handle the error
appropriately.

<p>
<span class="note"><b class="label">Note:</b>
According to the letter of <a class="rfc" id='rfcref-102758' xml:id='rfcref-102758'
href="http://www.faqs.org/rfcs/rfc2616.html">RFC 2616</a>, 301 and 302 responses to
  POST requests must not be automatically redirected without
  confirmation by the user.  In reality, browsers do allow automatic
  redirection of these responses, changing the POST to a GET, and
  <tt class="module">urllib</tt> reproduces this behaviour.</span>

<p>
The parameters to the constructor are the same as those for
<tt class="class">URLopener</tt>.

<p>
<span class="note"><b class="label">Note:</b>
When performing basic authentication, a
<tt class="class">FancyURLopener</tt> instance calls its
<tt class="method">prompt_user_passwd()</tt> method.  The default implementation asks
the users for the required information on the controlling terminal.  A
subclass may override this method to support more appropriate behavior
if needed.</span>
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-3905' xml:id='l2h-3905' class="exception">ContentTooShortError</tt></b>(</nobr></td>
  <td><var>msg</var><big>[</big><var>, content</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
This exception is raised when the <tt class="function">urlretrieve()</tt> function
detects that the amount of the downloaded data is less than the 
expected amount (given by the <var>Content-Length</var> header). The
<tt class="member">content</tt> attribute stores the downloaded (and supposedly
truncated) data.

<span class="versionnote">New in version 2.5.</span>

</dl>

<p>
Restrictions:

<p>

<ul>
<li>Currently, only the following protocols are supported: HTTP, (versions
0.9 and 1.0), Gopher (but not Gopher-+), FTP, and local files.
<a id='l2h-3906' xml:id='l2h-3906'></a><a id='l2h-3907' xml:id='l2h-3907'></a><a id='l2h-3908' xml:id='l2h-3908'></a>
<p>
</li>
<li>The caching feature of <tt class="function">urlretrieve()</tt> has been disabled
until I find the time to hack proper processing of Expiration time
headers.

<p>
</li>
<li>There should be a function to query whether a particular URL is in
the cache.

<p>
</li>
<li>For backward compatibility, if a URL appears to point to a local file
but the file can't be opened, the URL is re-interpreted using the FTP
protocol.  This can sometimes cause confusing error messages.

<p>
</li>
<li>The <tt class="function">urlopen()</tt> and <tt class="function">urlretrieve()</tt> functions can
cause arbitrarily long delays while waiting for a network connection
to be set up.  This means that it is difficult to build an interactive
Web client using these functions without using threads.

<p>
</li>
<li>The data returned by <tt class="function">urlopen()</tt> or <tt class="function">urlretrieve()</tt>
is the raw data returned by the server.  This may be binary data
(such as an image), plain text or (for example) HTML<a id='l2h-3917' xml:id='l2h-3917'></a>.  The
HTTP<a id='l2h-3909' xml:id='l2h-3909'></a> protocol provides type information in the
reply header, which can be inspected by looking at the
<span class="mailheader">Content-Type:</span> header.  For the
Gopher<a id='l2h-3910' xml:id='l2h-3910'></a> protocol, type information is encoded
in the URL; there is currently no easy way to extract it.  If the
returned data is HTML, you can use the module
<tt class="module"><a href="module-htmllib.html">htmllib</a></tt><a id='l2h-3918' xml:id='l2h-3918'></a> to parse it.

<p>
</li>
<li>The code handling the FTP<a id='l2h-3919' xml:id='l2h-3919'></a> protocol cannot differentiate
between a file and a directory.  This can lead to unexpected behavior
when attempting to read a URL that points to a file that is not
accessible.  If the URL ends in a <code>/</code>, it is assumed to refer to
a directory and will be handled accordingly.  But if an attempt to
read a file leads to a 550 error (meaning the URL cannot be found or
is not accessible, often for permission reasons), then the path is
treated as a directory in order to handle the case when a directory is
specified by a URL but the trailing <code>/</code> has been left off.  This can
cause misleading results when you try to fetch a file whose read
permissions make it inaccessible; the FTP code will try to read it,
fail with a 550 error, and then perform a directory listing for the
unreadable file. If fine-grained control is needed, consider using the
<tt class="module">ftplib</tt> module, subclassing <tt class="class">FancyURLOpener</tt>, or changing
<var>_urlopener</var> to meet your needs.

<p>
</li>
<li>This module does not support the use of proxies which require
authentication.  This may be implemented in the future.

<p>
</li>
<li>Although the <tt class="module">urllib</tt> module contains (undocumented) routines
to parse and unparse URL strings, the recommended interface for URL
manipulation is in module <tt class="module"><a href="module-urlparse.html">urlparse</a></tt><a id='l2h-3920' xml:id='l2h-3920'></a>.

<p>
</li>
</ul>

<p>

<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<a name="CHILD_LINKS"><strong>Subsections</strong></a>

<ul class="ChildLinks">
<li><a href="urlopener-objs.html">18.5.1 URLopener Objects</a>
<li><a href="node577.html">18.5.2 Examples</a>
</ul>
<!--End of Table of Child-Links-->
</div>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="18.4.5 wsgiref.handlers - server/gateway"
  href="module-wsgiref.handlers.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="18. internet Protocols and"
  href="internet.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="18.5.1 urlopener Objects"
  href="urlopener-objs.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-wsgiref.handlers.html">18.4.5 wsgiref.handlers - server/gateway</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="internet.html">18. Internet Protocols and</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="urlopener-objs.html">18.5.1 URLopener Objects</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
